//
//  Globals.m
//  Conference
//
//  Created by chenxin on 12-11-15.
//
//

#import "Globals.h"

@implementation Globals

@synthesize sLanguage;
@synthesize sAlarmUpdate;
@synthesize sNewsUpdate;
@synthesize sPickUpUpdate;
@synthesize sSeeOffUpdate;
@synthesize sPlaceUpdate;
@synthesize sEleSpeakUpdate;
@synthesize progress_view;
@synthesize servierUrl;
static Globals *sharedManager=nil;
-(id)init{
	if (self =[super init]) {
        sLanguage=@"false";
         sAlarmUpdate=@"";
         sNewsUpdate=@"";
         sPickUpUpdate=@"";
         sSeeOffUpdate=@"";
         sPlaceUpdate=@"";
         sEleSpeakUpdate=@"";
        servierUrl=@"http://app.citssh.com.cn/";
        
         UIView *view=[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
		 view.backgroundColor=[[UIColor grayColor] colorWithAlphaComponent:0.0f];
        
        UIImageView *image_bg=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bg_load.png"]];
        image_bg.frame=CGRectMake(115, 140, 90, 90);
        
        [view addSubview:image_bg];
        [image_bg release];
		
		UIActivityIndicatorView *indicatorView=[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
		[indicatorView startAnimating];
        
		indicatorView.frame= CGRectMake(142,167 , 37, 37);
        
		[view addSubview:indicatorView];
		[indicatorView release];
		self.progress_view=view;
		[view release];
        
    }
    return self;
}

+(Globals *)getInstance{
	@synchronized(self){
		if(sharedManager ==nil){
			sharedManager=[[self alloc] init];
		}
	}
	return sharedManager;
}


-(void)showAlertView:(NSString *) msg{
    
    UIAlertView *alertView =[[UIAlertView alloc] initWithTitle:@"提示" message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
    
    [alertView show];
    
    [alertView release];
    
}
-(CGSize)CalculationCellSize:(CGFloat)contentWidth fontSize:(int)fontSize content:(NSString*)content{
// 列寬
//CGFloat contentWidth = self.table.frame.size.width;
// 字体
UIFont *font = [UIFont systemFontOfSize:fontSize];
//NSString *content=data.message;
// 計算出顯示完內容需要的最小尺寸
CGSize size = [content sizeWithFont:font constrainedToSize:CGSizeMake(contentWidth, 1000) lineBreakMode:UILineBreakModeWordWrap];
    return size;
}

-(void)dealloc{

    [progress_view release];
    [super dealloc];
}
@end
